﻿using System.Configuration;
using System.Reflection;
using System;

namespace Mayfair.Core.Common.DI
{
    public class DIContainerFactory
    {
        private static DIContainer instance;
 
        public static DIContainer GetDIContainer()
        {
            try
            {
                if (instance == null)
                {
                    Assembly exe = Assembly.GetExecutingAssembly();
                    instance = (DIContainer)exe.CreateInstance(ConfigurationManager.AppSettings.Get("DIContainer"));
                }
                return instance;
            }
            catch (Exception e)
            {
                throw new Exception("DIContainerの生成に失敗しました", e);
            }
        }
    }
}
